package com.hipmarket.platform.security.config

import com.hipmarket.platform.security.expression.JwtMethodSecurityExpressionHandler
import com.hipmarket.platform.security.expression.JwtPermissionEvaluator
import org.springframework.context.annotation.Configuration
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration

@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
class JwtMethodSecurityConfiguration: GlobalMethodSecurityConfiguration() {


    override fun createExpressionHandler(): MethodSecurityExpressionHandler {
        val handler = JwtMethodSecurityExpressionHandler()
        handler.setPermissionEvaluator(JwtPermissionEvaluator())
        return handler
    }


}